#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=21;
int n,L,A[N],B[N],ans;
int main()
{
	freopen("lock.in","r",stdin);
	freopen("lock.out","w",stdout);
    scanf("%d%d",&n,&L);
    for(int a=0;a<n;a++) scanf("%d%d",&A[a],&B[a]);
    int Max=(1<<n)-1;
    for(int z=0;z<=Max;z++)
    {
    	int x=0,y=0;
    	for(int a=0;a<n;a++)
    	{
    		if(z&(1<<a)) x^=A[a],y^=B[a];
		}
		if(x<=L) ans=max(ans,y);
	}
	printf("%d",ans);
}
